using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Tormenta.Utils
{
    public class ItemBase: DrawableGameComponent
    {

        public ItemBase(Game game)
            : base(game)
        {
            spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
        }

        #region Properties

        SpriteBatch spriteBatch;

        public Vector2 Position { get; set; }

        public Vector2 Speed { get; set; }

        public Texture2D Texture { get; set; }

        public string ContentName { get; set; }

        #endregion

        #region Methods

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            this.Position = Physics.GetPosition(this.Position, this.Speed, gameTime.ElapsedGameTime.TotalMilliseconds);
        }

        public override void Draw(GameTime gameTime)
        {
            spriteBatch.Draw(this.Texture, this.Speed, Util.TRANSPARENT_COLOR);
            base.Draw(gameTime);
        }

        public virtual void Hide()
        {
            this.Visible = false;
            this.Enabled = false;
        }

        public virtual void Show()
        {
            this.Visible = true;
            this.Enabled = true;
        }

        #endregion
    }
}
